package com.soo.hoo.admin.api;

import com.soo.hoo.admin.model.entity.SysLog;
import com.soo.hoo.admin.service.LogService;
import com.soo.hoo.core.model.Page;
import com.soo.hoo.core.model.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>日志管理</p>
 *
 * @author 杨燚
 * @since 2024/1/10
 */
@Tag(name = "日志管理")
@RequestMapping("/log/")
@RestController
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class LogController {

    private final LogService logService;

    @Operation(summary = "操作日志分页")
    @PostMapping("optLogPage")
    public Result<Page<SysLog>> pageOptLogPage(@RequestBody Page<SysLog> param) {
        return Result.success(logService.page(param, 0));
    }

    @Operation(summary = "登录日志分页")
    @PostMapping("entryLogPage")
    public Result<Page<SysLog>> pageEntryLog(@RequestBody Page<SysLog> param) {
        return Result.success(logService.page(param, 1));
    }
}
